#pragma once
#include <QObject>
#include <QPen>
#include <QColor>

enum PainState {
	NONE,           //空闲状态（安左键推线，中键移动画布）
	PUSH_LINE,      //推线状态
	MOVE_CANVAS,    //移动状态
	DELETE,         //删除状态
	ROTATE          //旋转状态
};
class ConfigUI : public QObject {
	Q_OBJECT;
public:
	ConfigUI(QObject* parent) :QObject(parent) {};
	~ConfigUI() {}
	//1.需要读取和写入的信息
	QString m_qFilePath = "./data";
	QString m_qFileName = "example.txt";

	//2.画笔相关信息
	int m_r = 2;  //实心点半径
	QPen m_defaultPen = QPen(QColor(65, 105, 225), 2);	//默认画笔
	QPen m_blackPen = QPen(Qt::black, 2);
	QPen m_resPen = QPen(Qt::green, 2);	//默认画笔

	//3.状态信息
	PainState painState = NONE;     //绘图模式
	// 5.1选项对应的bool值
	bool m_showFlyLines = true;		//显示飞线
	bool m_showWires = true;		//显示布线结果
	bool m_showObss = true;			//显示障碍物
	bool m_showCorners = false;		//显示规划点
	bool m_showPathPts = false;		//显示路径点
	bool m_show_resPts = false;		//显示结果点

	int m_gridType = 1;				//0无网格，1线形网格，2点形网格
	bool m_onGrids = false;
	bool m_postOn = false;
	int m_postMode = 1;
	float m_minimalScreenGridSize = 16;
	float m_gridSize = 50;

	//4.显示的坐标轴方向
	bool m_flip_left_right = false;
	bool m_flip_up_down = true;
	bool m_rotate_90 = false;

	//5.配置信息操作
	void configUpdate(const QString& qFilePath, const QString& qFileName);
	bool read_config();
	bool write_config()const;
};


